Skip to content

Edit type hierarchy relationships in the Type Editor - #1876

Closed
PaulHax wants to merge 5 commits into
Kitware:mainfrom
PaulHax:type-hierarchy-editor
Closed

Edit type hierarchy relationships in the Type Editor#1876
PaulHax wants to merge 5 commits into
Kitware:mainfrom
PaulHax:type-hierarchy-editor

Conversation

@PaulHax

@PaulHax PaulHax commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Edit type hierarchy relationships in the Type Editor

DIVE can display and import type hierarchies, but users currently have to edit configuration JSON
to create or change the relationships.

This PR adds Parent Type to the existing Type Editor opened from a Type List row's pencil. There
is no separate hierarchy mode: types remain ordinary types, and a type may optionally have a parent.

Parent-only edits change the dataset hierarchy without rewriting stored annotation confidence
pairs. A dataset with no parent edges keeps its existing flat behavior.

Changes

  • Add a searchable, clearable Parent Type field with up to 50 existing-type suggestions. Add
    missing parents through + Types in Type Settings.
  • Create, change, or clear parent relationships without rewriting annotation confidence pairs.
  • Validate name and parent edits together, show errors inline, and disable invalid saves. Recheck
    the complete edit before applying any changes.
  • Delete unused headings by promoting their children; block deletion if any camera uses the type.
  • Preserve flat rename behavior and retain standalone types when the final parent edge is removed.
  • Discard drafts on dataset changes, respect Read Only Mode, and keep parent controls out of group
    and Saved Styles editors.
  • Add regression tests and update the Type List documentation.

Validation

  • Full non-integration gate passed on 1cfa6e0a: 400 server tests, 1,346 client/Desktop tests,
    server and client lint, Web build, and Electron AppImage build.
  • Client typecheck passed.
  • Desktop and multicamera manual verification remain pending. Live integration tests were not run.

Manual tests

Test data is available from
PaulHax/dive-devkit.

From a workspace containing dive/ and dive-devkit/:

dive-devkit/tools/up.sh <worktree>
cd dive/<worktree>/client
VITE_PORT=3000 VITE_API_PROXY_TARGET=http://localhost:8010 npm run serve

Create and remove a hierarchy edge

  1. Open Flat classification three tracks.
  2. Hover over tuna in the Type List, click its pencil, and select fish as Parent Type.
  3. Save the Type Editor, then save the dataset and reload.
  4. Reopen tuna, clear Parent Type, save the editor and dataset, and reload again.

Verify:

  • tuna appears beneath fish after the first save and reload.
  • Clearing the final edge returns the Type List to flat behavior.
  • The fish, tuna, and dolphin annotations and confidence values are unchanged.
  • Both fish and tuna remain available after the final edge is removed.

Reparent and validate atomically

  1. Open Hierarchical classification multipair.
  2. Change bluefin-tuna from parent tuna to parent red-snapper.
  3. Confirm its tree position changes without changing the stored bluefin-tuna, tuna, and fish
    confidence values, then restore its original parent.
  4. Edit fish and select bluefin-tuna as its parent.
  5. Enter unmatched text in Parent Type without selecting a suggestion.
  6. Make a valid parent edit and press Cancel.

Verify:

  • Saving a valid reparent updates the tree immediately.
  • Selecting the cyclic parent shows an error beneath Parent Type before saving.
  • Save is disabled while the cycle exists, and no changes are applied.
  • Unmatched text directs the user to add the type through Type Settings.
  • Save is disabled while the parent text remains unresolved.
  • Cancel leaves the tree unchanged.
  • Cancel leaves the save badge unchanged.

Rename and reparent together

  1. In Hierarchical classification multipair, edit the unused unobserved-species type.
  2. Change its name and select fish as its new parent in the same editor session.
  3. Save the Type Editor.

Verify:

  • The old name disappears.
  • The new name appears beneath fish.
  • Both changes apply together, with no intermediate hierarchy or partial rename visible.

Delete unused hierarchy headings

  1. Open a fresh Hierarchical classification multipair dataset.
  2. Delete unobserved-genus.
  3. Delete the unused top-level eukaryota.
  4. Try to delete a used type such as bluefin-tuna.
  5. Save the dataset and reload.

Verify:

  • unobserved-species moves directly beneath vertebrata.
  • animalia becomes top-level after eukaryota is removed.
  • Descendant names and confidence pairs are unchanged.
  • Deletion remains disabled for the used type.
  • The promoted hierarchy persists after reload.

Parent search

  1. Open SEFSC-SEAMAP fish taxonomy.
  2. Edit seriola_rivoliana and search Parent Type by both prefix and substring.
  3. Use the arrow keys and Enter to select a result, then clear the field and press Cancel.

Verify:

  • Suggestions remain responsive and appear in a consistent order.
  • Arrow keys and Enter select a result.
  • The current parent remains available.
  • Clearing the field represents a top-level type.
  • No new type is created.

Multicamera persistence

  1. Open Hierarchical classification multicam divergent.
  2. Reparent a used type, save the Type Editor and dataset, then switch cameras and reload.
  3. Attempt to delete a type that is present in stored confidence pairs.

Verify:

  • Both camera views use the same edited hierarchy after reload.
  • Reparenting does not rewrite either camera's confidence vector.
  • Usage on any camera keeps deletion disabled.

This is a follow-up to
Render hierarchical types as a tree.

@PaulHax

PaulHax commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #1877, which uses the type-hierarchy-editor branch in Kitware/dive instead of the fork. The commits and PR description are unchanged.

@PaulHax PaulHax closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant